using ASP;
using HoWave.Web;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI;
public class IMS_ad_ADCount : Page, IRequiresSessionState
{
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (base.Request.QueryString["Action"] != null)
		{
			if (base.Request.QueryString["ADID"] != null)
			{
				AdBll adBll = new AdBll();
				if (base.Request.QueryString["Action"].ToString() == "Click")
				{
					DataTable dataTable = adBll.UpdateADCount(int.Parse(base.Request.QueryString["ADID"].ToString()));
					if (dataTable.Rows.Count > 0)
					{
						string text = dataTable.Rows[0]["LinkUrl"].ToString();
						if (text != "")
						{
							this.Page.Response.Redirect(text);
						}
						else
						{
							base.Response.Write("没有连接地址");
						}
					}
				}
				else
				{
					adBll.UpdateAdViews(int.Parse(base.Request.QueryString["ADID"].ToString()));
				}
			}
		}
	}
}
